#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int count = 0;
	int i = 0;
	for (i = 1; i <= 2019; i++)
	{
		int m = i;
		while (m)
		{
			if (m % 10 == 9)
			{
				count++;
				break;
			}
			m=m / 10;
		}
	}
	printf("%d\n", count);
	return 0;
}